package com.lfg.leetcode.leetcode0;

import java.util.ArrayList;
import java.util.List;
import java.util.Stack;

public class No94inorderTraversal {

    public static void main(String[] args) {
        List<Integer> ret = inorderTraversal(TreeNode.stringToTreeNode("[1,null,2,3]"));
        for (Integer str : ret) {
            System.out.println("[" + str + "]");
        }
    }

    public static List<Integer> inorderTraversal(TreeNode root) {
        List<Integer> ret = new ArrayList<>();
        if (root == null) {
            return ret;
        }
        Stack<TreeNode> stack = new Stack<>();

        return ret;
    }

    public static List<Integer> inorderTraversal2(TreeNode root) {
        List<Integer> ret = new ArrayList<>();
        if (root == null) {
            return ret;
        }
        inorderTraversal(root, ret);
        return ret;
    }

    public static void inorderTraversal(TreeNode node, List<Integer> ret) {
        if (node.left != null) {
            inorderTraversal(node.left, ret);
        }
        ret.add(node.val);
        if (node.right != null) {
            inorderTraversal(node.right, ret);
        }
    }

}

